const express = require('express');
const router = express.Router();
const query=require('../public/javascripts/query');

let sql='';
router.post('/', function(req, res, next) {
  let data=req.body;
  let username = data.username,
    password= data.password;
  sql="insert into userinfo(username,password) values('"+username+"','"+password+"')";
  // console.log(data);
  query(sql,function(err,rows){
    if(err){
      // console.log("err: "+err);
      res.send({code:0});
    }else {
      // console.log(rows);
      res.send({code:1});
    }
  });
});

module.exports = router;
